package artibella.ui.forms 
{
	import artibella.text.StylesManager;
	import flash.display.MovieClip;
	import flash.text.AntiAliasType;
	import flash.text.TextField;
		
	
	/**
	 * @author pbordachar
	 */
	
	public class RadioButton extends ARadioButton
	{
		private var _toggle:MovieClip;
		private var _txt:TextField;
		
		public function RadioButton() { }
		
		override protected function _init():void
		{
			super._init();
			
			_toggle = new Toggle_FC();
			_toggle.gotoAndStop( 1 );
			addChild( _toggle );
		}
		
		// - - -
		
		override public function doClick():void
		{
			_toggle.gotoAndStop( 2 );
		}
		
		override public function undoClick():void
		{
			_toggle.gotoAndStop( 1 );
		}
		
		// - - -
		
		public function setText( value:String, css_class:String, embed:Boolean = true ):void
		{
			//var format:TextFormat = new TextFormat();
			//format.font = FontsManager.getFontByName( "Arial" );
			//format.size = 10;
			//format.color = 0xFFFFFF;

			_txt = new TextField();
			_txt.defaultTextFormat = StylesManager.instance.getStyleFormat( css_class );
			_txt.antiAliasType = AntiAliasType.ADVANCED;
			_txt.embedFonts = true;
			_txt.autoSize = "left";
			_txt.wordWrap = false;
			_txt.multiline = false;
			_txt.selectable = false;
			_txt.text = vlue;
			//_txt.setTextFormat( format );

			_txt.x = 0;
			_txt.y = 4;
			addChild( _txt );
			
			_toggle.x = _txt.x + _txt.width + 10;
			_toggle.y = 0;
		}
	}
}